x<-read.table("res_gibbs_MS_Credit.txt",header=TRUE)
#x<-read.table("temp.txt",header=TRUE)
#x<-x[-10,]))
library(ggplot2)
library(reshape)
m<-apply(x,2,mean)
y<-apply(x,2,quantile,prob=c(0,0.20,0.80,1))
p<-ncol(x)
y2<-structure(as.vector(t(y)),.Dim=c(ncol(y),4),.Dimnames=list(seq(1,ncol(y)),c("Q0","Q1","Q2","Qinf")))
y1<-melt(y2)
y1 <- rename(y1, c(X1="cov",X2="quant"))
y1$m<-m
cbPalette <- c("#999999", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7")
cbPalette <- c("#999999", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7")
cbPalette<-c("#999999","#000000","#FFFFFF","#000000")
cbPalette<-c("#000000","#FFFFFF","#000000","#999999")
y<-as.data.frame(t(y))
colnames(y)<-c("Q0","Q1","Q2","Qinf")
y$mi<-m
y<-as.data.frame(y)
a<-ggplot(y)+geom_bar(aes(x=1:p,y=Qinf,fill="#000000"),stat="identity")+
geom_bar(aes(x=1:p,y=Q2,fill="#FFFFFF"),stat="identity")+
geom_bar(aes(x=1:p,y=Q1,fill="#000000"),stat="identity")+
geom_bar(aes(x=1:p,y=Q0),stat="identity")+geom_errorbar(aes(x=1:p,y=mi,ymin=mi,ymax=mi),color="#AA0000")+coord_flip()+opts(legend.position="none")+scale_fill_manual(values=cbPalette)+labs(y = NULL, x ="covariates",fill = NULL)
#a<-ggplot(y1,aes(x=cov,y=value,fill=factor(quant)))+labs(x = NULL, y ="",fill = NULL)+
#geom_bar(stat="identity",position="dodge")+scale_fill_manual(values=cbPalette)+geom_errorbar(aes(y=m, ymax=m, ymin=m), colour="#AA0000")+
#

